package flc.ast.fragment;

import android.content.Intent;
import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import flc.ast.R;
import flc.ast.activity.SelPicActivity;
import flc.ast.databinding.FragmentEditBinding;
import flc.ast.utils.Content;
import stark.common.basic.base.BaseNoModelFragment;
import stark.common.basic.event.EventStatProxy;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link EditFragment#newInstance} factory method to
 * create an instance of this fragment.
 */
public class EditFragment extends BaseNoModelFragment<FragmentEditBinding> {


    @Override
    protected int onCreate() {
        return R.layout.fragment_edit;
    }

    @Override
    protected void initView() {
        EventStatProxy.getInstance().statEvent1(getActivity(), mDataBinding.event1Container);
        EventStatProxy.getInstance().statEvent5(getActivity(), mDataBinding.event5Container);
        mDataBinding.llPicCut.setOnClickListener(this);
        mDataBinding.llPicBeauty.setOnClickListener(this);
        mDataBinding.llPicFilter.setOnClickListener(this);
        mDataBinding.llPicSticker.setOnClickListener(this);
        mDataBinding.llPicDoodle.setOnClickListener(this);
        mDataBinding.llPicRotate.setOnClickListener(this);
        mDataBinding.llPicMosaic.setOnClickListener(this);
        mDataBinding.llPicText.setOnClickListener(this);
        mDataBinding.llPicAdjust.setOnClickListener(this);
    }

    @Override
    protected void onClickCallback(View v) {
        switch (v.getId()){
            case R.id.llPicCut:
                gotoSelPic(Content.Edit_Cut);
                break;
            case R.id.llPicBeauty:
                gotoSelPic(Content.Edit_Beauty);
                break;
            case R.id.llPicFilter:
                gotoSelPic(Content.Edit_Filter);
                break;
            case R.id.llPicSticker:
                gotoSelPic(Content.Edit_Sticker);
                break;
            case R.id.llPicDoodle:
                gotoSelPic(Content.Edit_Doodle);
                break;
            case R.id.llPicRotate:
                gotoSelPic(Content.Edit_Rotate);
                break;
            case R.id.llPicMosaic:
                gotoSelPic(Content.Edit_Mosaic);
                break;
            case R.id.llPicText:
                gotoSelPic(Content.Edit_Text);
                break;
            case R.id.llPicAdjust:
                gotoSelPic(Content.Edit_Adjust);
                break;
        }
    }

    @Override
    protected void initData() {

    }

    //去到选择图片界面
    private void gotoSelPic(String flag) {
        Intent intent = new Intent(mContext, SelPicActivity.class);
        intent.putExtra(Content.Flag, flag);
        startActivity(intent);
    }

}